package com.report.task;

import com.aliyun.oss.model.OSSObject;
import lombok.extern.slf4j.Slf4j;

import javax.servlet.http.HttpServletResponse;
import java.util.TimerTask;
import java.util.concurrent.CompletableFuture;

/**
 * @author summer
 * @version 1.0
 * @date 2024/8/12 21:58
 */
@Slf4j
public class DownloadTimerTask extends TimerTask {
    private OSSObject ossObject;

    private HttpServletResponse response;

    public DownloadTimerTask(OSSObject ossObject, HttpServletResponse response) {
        this.ossObject = ossObject;
        this.response = response;
    }

    @Override
    public void run() {
         log.info("异步下载文件开始-------------------");
        CompletableFuture.runAsync(new DownloadTask(ossObject,response)::run);
    }
}
